package com.etc.dao;


import com.etc.entity.Record;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AdminRecordDao extends JpaRepository<Record, Integer> {


    @Query(nativeQuery = true, value = "SELECT r.rid,u.username,c.cname,r.buytime,r.payprice " +
            "from record r " +
            "INNER JOIN  `user` u  " +
            "on r.userid=u.userid " +
            "INNER JOIN  cinema c " +
            "on c.cid=r.cid " +
            "where u.username like %?3% " +
            "GROUP BY r.buytime DESC " +
            "limit ?1,?2")
    public List<Object[]> FindAllRecordByAdmin(int start,int limit,String username);
}
